package com.fla.shapeevader.ui.drawers;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;

import com.fla.shapeevader.model.BaseShape;

public class UserShapeDrawer extends CircleDrawer {
    private boolean happy = true;

    public UserShapeDrawer(BaseShape shape) {
        super(shape, Color.YELLOW);
    }

    public void setHappy(boolean happy) {
        this.happy = happy;
    }

    @Override
    public void drawOnCanvas(Canvas canvas) {
        RectF bounds = shape.getBounds();
        
        Paint paint = new Paint();
        paint.setStrokeWidth(1);
        paint.setStyle(Style.FILL);
        paint.setColor(color);

        canvas.drawOval(bounds, paint);

        paint.setColor(Color.BLACK);

        // eyes
        canvas.drawCircle(bounds.left + bounds.width() / 4, bounds.top + bounds.height() / 4, 5, paint);
        canvas.drawCircle(bounds.left + 3 * bounds.width() / 4, bounds.top + bounds.height() / 4, 5, paint);
        
        paint.setStyle(Style.STROKE);
        
        // mouse
        RectF oval = new RectF(
                bounds.left + bounds.width() / 5, 
                bounds.bottom - bounds.height() / 2, 
                bounds.left + 4 * bounds.width() / 5, 
                bounds.bottom - bounds.height() / 10);

        float start = happy ? 0 : 180;
        canvas.drawArc(oval, start, 180, false, paint);
    }
}
